
//账号登录
jkCaptchaFn(
    '#captcha2',
    (captchaObj) => {
        // 1. 绑定点击事件
        $('.duanxindenglu').click(function () {
            // 行为验证码
            if (!captchaObj.getValidate()) {
                cocoMessage.error("行为验证码错误", 3000);
                return
            }

            //请求接口
            let mobile=$('.mobile').val()
            let code=$('.code').val()
            $.post('/api/sms/login.jsp',{mobile,code},res=>{
              // console.log(res);
              if(res.meta.state===200){
                cocoMessage.success(res.meta.msg, 3000);
                if($('#sms-remember').prop('checked')){
                  localStorage.setItem('token',res.data.token)
                  localStorage.setItem('uname',res.data.uname)
                  localStorage.setItem('expires',(new Date).getTime()+1*1000*60*60*24*7)
                }else{
                  sessionStorage.setItem('token',res.data.token)
                  sessionStorage.setItem('uname',res.data.uname)
                }
                setTimeout(()=>{
                  location.href='./index.html'
                },2500)
              }else{
                cocoMessage.error(res.meta.msg, 3000);
              }
            },'json')


        })
    },
    '280px'
)
